<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>管理试卷</title>
	<meta name="description" content="这是一个 index 页面">
	<meta name="keywords" content="index">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="renderer" content="webkit">
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="icon" type="image/png" href="../assets/i/favicon.png">
	<link rel="apple-touch-icon-precomposed" href="../assets/i/app-icon72x72@2x.png">
	<meta name="apple-mobile-web-app-title" content="Amaze UI" />
	<link rel="stylesheet" href="../assets/css/amazeui.min.css" />
	<link rel="stylesheet" href="../assets/css/amazeui.datatables.min.css" />
	<link rel="stylesheet" href="../assets/css/bootstrap.min.css">
	<link rel="stylesheet" href="../assets/css/bootstrap-reset.css">
	<link rel="stylesheet" href="../assets/css/app.css">
	<link rel="stylesheet" href="../assets/css/gb_my.css">
	<link rel="stylesheet" href="../assets/css/font-awesome.css">
	<link rel="stylesheet" href="../assets/css/easydropdown.css">
</head>
<body data-type="chart">
	<div class="am-g tpl-g">
		<!--头部-->
		<nav class="navbar navbar-default top-navbar">
			<div class="navbar-header">
				<a class="navbar-brand waves-effect waves-dark" href="javascript:;">
					<img src="../assets/img/logo.png" alt="">
					<strong>轻课网考试系统</strong>
				</a>
				<div id="sideNav" href="">
					<i class="mulv QK QK-mulu"></i>
				</div>
			</div>

			<ul class="nav navbar-top-links navbar-right aaa">
				<li>
					<a id="down_" class="sign-out dropdown-button waves-effect waves-dark" href="javascript:;">
						<span class="am-icon-sign-out"></span> 退出
					</a>
				</li>
				<li>
					<a class="dropdown-button waves-effect waves-dark" href="javascript:;"><b>欢迎你, <span class="userName"></span> </b></a>
				</li>
			</ul>
		</nav>
		<!--导航栏-->
		<nav class="navbar-default navbar-side">
			<div class="sidebar-collapse">
				<!--用户头像-->
				<div class="tpl-sidebar-user-panel">
					<div class="tpl-user-panel-slide-toggleable">
						<div class="tpl-user-panel-profile-picture">
							<img src="../assets/img/user04.png" alt="">
						</div>
					</div>
				</div>
				<dl class="list_dl">
					<dt class="list_dt">
						<a href="../index.html">
							<span class="QK1 start_before"></span>
							<p>首页</p>
						</a>
					</dt>
					<dt class="list_dt">
						<span class="QK1 topic_before"></span>
						<p>题库管理</p>
						<i class="QK1 list_dt_icon"></i>
					</dt>
					<dd class="list_dd">
						<ul>
							<li class="list_li">
								<a href="../questiondb/questiondb.html">管理题库</a>
							</li>
							<li class="list_li">
								<a href="../question/question.html">管理试题</a>
							</li>
						</ul>
					</dd>
					<dt id="open" class="list_dt">
						<span class="QK1 paper_before"></span>
						<p>试卷管理</p>
						<i class="QK1 list_dt_icon"></i>
					</dt>
					<dd class="list_dd" style="display: block">
						<ul>
							<li class="list_li">
								<a href="../paper/addpaper.html">创建试卷</a>
							</li>
							<li class="list_li" id="style_li_a">
								<a href="../paper/paper.html">管理试卷</a>
							</li>
						</ul>
					</dd>
					<dt class="list_dt">
						<span class="QK1 system_before"></span>
						<p>系统管理</p>
						<i class="QK1 list_dt_icon"></i>
					</dt>
					<dd class="list_dd">
						<ul>
							<li class="list_li">
								<a href="../system.html">系统管理</a>
							</li>
							<li class="list_li">
								<a href="../admin/admin.html">管理员</a>
							</li>
							<li class="list_li">
								<a href="../adminroles/adminroles.html">角色管理</a>
							</li>
						</ul>
					</dd>
					<dt class="list_dt">
						<span class="QK1 user_before"></span>
						<p>用户管理</p>
						<i class="QK1 list_dt_icon"></i>
					</dt>
					<dd class="list_dd">
						<ul>
							<li class="list_li">
								<a href="../user/user.html">管理用户</a>
							</li>
							<li class="list_li">
								<a href="../user/usergroup.html">用户分组</a>
							</li>
						</ul>
					</dd>
					<dt class="list_dt">
						<span class="QK1 user_before"></span>
						<p>知识点模块</p>
						<i class="QK1 list_dt_icon"></i>
					</dt>
					<dd class="list_dd">
						<ul>
							<li class="list_li">
								<a href="../KnowledgePoint/KnowledgeBlock.html">管理知识点</a>
							</li>
						</ul>
					</dd>
				</dl>
			</div>
		</nav>
		<!--内容区域-->
		<div id="page-wrapper">
			<div class="row">
				<div class="col-lg-7">
					<section class="panel">
						<header class="panel-heading">
							<span class="label label-primary">试题设置</span>
							<a href="#myModal19" data-toggle="modal">
								<button type="button" class="btn btn-success btn-sm add_clazz btn_my" id="copy">选择复制</button>
							</a>
						</header>
						<div class="panel-body">
							<table id="question" width="100%" class="table table-bordered table-striped table-condensed">
								<thead>
									<tr>
										<th>题型</th>
										<th>编号</th>
										<th>题干</th>
										<th>分值</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody id="questions">

								</tbody>
							</table>
							<div class="row paper_submission">
								<div class="col-lg-2 col-sm-2">
									<button type="button" class="btn btn-block submit_button" id="btnsubmit">提交</button>
								</div>
							</div>
						</div>
						<div id="myModal20" class="modal" data-easein="slideDownBigIn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
							<div class="modal-dialog center_modal">
								<div class="modal-content">
									<div class="modal-header title_header">
										<button type="button" class="close deleteall" data-dismiss="modal" aria-hidden="true">×</button>
										<!--<h4 class="modal-title">题干</h4>-->
									</div>
									<div class="modal-body" id="detailcontent">
										<ul>

										</ul>
									</div>
									<div class="modal-footer">
										<button class="btn btn-default deleteall" data-dismiss="modal" aria-hidden="true">关闭</button>
									</div>
								</div>
							</div>
						</div>
						<div id="myModal19" class="modal" data-easein="slideUpBigIn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
							<div class="modal-dialog">
								<div class="modal-content">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
										<h4 class="modal-title">选择一个进行COPY吧！</h4>
									</div>
									<div class="modal-body">
										<ul class="copy_all">
										</ul>
									</div>
									<div class="modal-footer">
										<button class="btn btn-primary submit_copy">提交</button>
										<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</button>
									</div>
								</div>
							</div>
						</div>
					</section>
				</div>
				<div class="col-lg-5">
					<section class="panel" data-spy="affix" data-offset-top="10">
						<header class="panel-heading select_add">
							<span class="label label-primary">添加分数</span>
							<select class="dropdown" name="question_tx" data-value="0" tabindex="9" data-settings='{"wrapperClass":"flat"}'>
								<option value="0">全部</option>
							</select>
							<select class="dropdown" name="question_lx" data-value="0" tabindex="9" data-settings='{"wrapperClass":"flat"}'>
								<option value="0">全部</option>
								<option value="1">单选</option>
								<option value="2">多选</option>
								<option value="3">填空</option>
								<option value="4">判断</option>
								<option value="5">问答</option>
							</select>
						</header>
						<div class="panel-body">
							<table width="100%" class="table table-bordered table-striped table-condensed">
								<thead>
									<tr>
										<th>编号</th>
										<th>类型</th>
										<th>题干</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody id="wraper">

								</tbody>
							</table>
							<div>
								<ul class="box">
									<li class="prev"></li>
									<li>
										<ul class="box2"></ul>
									</li>
									<li class="next"></li>
									<li class="all_number numb"></li>
								</ul>
							</div>
						</div>
						<div id="myModal5" class="modal" data-easein="flipBounceYIn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
							<div class="modal-dialog">
								<div class="modal-content">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
										<h4 class="modal-title">添加成绩</h4>
									</div>
									<div class="modal-body">
										<div class="row">
											<label class="col-lg-2 col-sm-2 control-label modal_body_add">题型</label>
											<div class="col-lg-4 text_test">
												<select class="dropdown select" name="sectionName"></select>
											</div>
										</div>
										<div class="row">
											<label class="col-lg-2 col-sm-2 control-label modal_body_add">分值</label>
											<div class="col-lg-4 text_test">
												<input type="text" class="form-control" id="remark" name="remark" placeholder="请设定分值">
											</div>
										</div>
									</div>
									<div class="modal-footer">
										<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">取消</button>
										<button class="btn btn-primary submit_mark">提交</button>
									</div>
								</div>
							</div>
						</div>
					</section>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
<script src="../assets/js/jquery.min.js"></script>
<script src="../assets/js/theme.js"></script>
<script src="../assets/js/easydropdown.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="../assets/js/velocity.min.js"></script>
<script src="../assets/js/velocity.ui.min.js"></script>
<script src="../assets/js/labelauty.js"></script>
<script type="text/javascript" src="../assets/js/jquery.cookie.js"></script>
<script src="../assets/js/dataTables.responsive.min.js"></script>
<script src="../assets/js/app.js"></script>
<script>
	//复制试卷
	$(document).on('click' , '#copy' , function () {
		var arr_paper = [];
		$('.copy_all').empty();
        $.ajax({
			type: "get",
			async: false,
			url: localApi + "/Paper/index",
			data: {
				apikey: '1',
				limit: '999',
				offset:'0'
			},
			success: function(result) {
				$.each(result.data,function (n , item) {
//					console.log(item);
					arr_paper.push(item);
					var paper_li = '<li><input type="radio" name="rdo" class="rdolist" /><label class="rdobox">' +
						'<span class="check-image"></span><span class="radiobox-content" id="'+ item.id +'">'+ item.paperName +'</span></label></li>';
					$('.copy_all').append(paper_li);
				});
			}
		});
        console.log(arr_paper);
        $(".rdolist").labelauty("rdolist", "rdo");
    });
	$(document).on('click' , '.submit_copy' , function () {
	    var id = $('.copy_all').children('li').children('.checked').children('.radiobox-content').attr('id');
        var qid = window.location.search.split("=")[1];
	    console.log(id);
		$.ajax({
            type: "post",
            url: localApi + "/Paper/copy",
            /*xhrFields: {
                withCredentials: true
            },
            crossDomain: true,*/
            data: {
                apikey: '2',
                oldId: qid,
                newId: id
            },
			success:function (result) {
                console.log(result);
                if(result.msg == "success"){
                    console.log(66666);
                    $("#myModal19").hide();
                    window.location.href = 'setpaper.html?id=' + qid;
				}
            },
			error:function () {
				alert("hhhhhhhh")
            }
		})
    });
</script>
<script>
	var change_sid = 0;
	var change_id = 0;
	getPage(1);
	//题库类型
	$.ajax({
		url: localApi + "/QuestionDb/all",
		type: 'get',
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		async: false,
		data: {
			apikey: '1'
		},
		success: function(result) {
//			            console.log(result.data);
			$.each(result.data, function(n, item) {
				$("select[name='question_tx']").append("<option value='" + item.id + "'>" + item.dname + "</option>");
				//                console.log(item);
			});
			//            all_data = result.data;
		}
	});

	$(document).ready(function() {
		$("select[name='question_tx']").change(function() {
			change_sid = $(this).children("option:selected").val();
			console.log(change_sid);
			getPage(1);
		});
		$("select[name='question_lx']").change(function() {
			change_id = $(this).children("option:selected").val();
			console.log(change_id);
			getPage(1);
		});
	});
	//翻页
	function getPage(pn) {
		$.ajax({
			url: localApi + "/QuestionWithBLOBs/count",
			type: 'get',
			xhrFields: {
				withCredentials: true
			},
			crossDomain: true,
			async: false,
			data: {
				apikey: '1',
				dbid: change_sid,
				qtype: change_id,
				pname:""
				
			},
			success: function(result) {
				count = result.data;
				page = Math.round(count / 5);
				var dataCount = count; //总数据条数
				var pageSize = 5; //每页显示条数
				var pageCount = Math.ceil(dataCount / pageSize); //总页数
				if(pn == 0 || pn > pageCount) {
					return;
				}
				var ul = $("#wraper");
				ul.empty();
				//console.log(pageCount+"..."+pn)
				paintPage(pageCount, pn); //绘制页码
				$.ajax({
					url: localApi + "/QuestionWithBLOBs/index",
					type: 'get',
					xhrFields: {
						withCredentials: true
					},
					crossDomain: true,
					async: false,
					data: {
						apikey: '1',
						limit: '5',
						offset: (pn-1) * 5,
						dbid: change_sid,
						qtype: change_id,
						pname:""
						
					},
					success: function(result) {
						$.each(result.data, function(n, item) {
							if(item.questionDb != null) {
								var dname = item.questionDb.dname
							} else {
								dname = "null"
							}
							if(item.qtype == 1) {
								var qtype = "单选"
							} else if(item.qtype == 2) {
								qtype = "多选"
							} else if(item.qtype == 3) {
								qtype = "填空"
							} else if(item.qtype == 4) {
								qtype = "判断"
							} else {
								qtype = "问答"
							}
							var coulmn = '<tr class="even gradeX student add_p delete_some"><td class="qidnew">' + item.id + '</td><td>' + qtype + '</td><td>' + item.content + '</td>';
							coulmn += '<td class="operation"><div class="tpl-table-black-operation">' + '<a href="#myModal20" ' +
								'data-toggle="modal" class="tpl-table-black-operation-del button button--aylen detail" value=' + item.id + '><i class="QK1 QK-xiangqing spacing_detail">' +
								'</i>详情</a>' + '<a href="#myModal5" data-toggle="modal" value=' + item.id + ' class="tpl-table-black-operation-del button button--aylen sidnew">' +
								'<i class="QK1 QK-tianjia spacing"></i>添加</a></div></td></tr>';
							$("#wraper").append(coulmn);
						});
						$('.gradeX').find('td:nth-child(2)').children(':first-child').siblings().remove();
						$('.delete_some').find('td:nth-child(3)').children(':first-child').nextAll().remove()
					}
				});
			}
		});
	}

	//绘制页码
	function paintPage(number, currNum) //number 总页数,currNum 当前页
	{
        var pageUl = $(".box");
        var nextLi = $('.next'),
            prevLi = $('.prev'),
            pageUl2 = $('.box2'),
            pageNumber = $('.all_number');
        nextLi.empty();
        prevLi.empty();
        pageUl2.empty();
        pageNumber.empty();
        var ulDetail = "";

        //上一页
        if(currNum > 1){
            prevLi.append('<a href="javascript:getPage(' + parseInt(currNum - 1) + ')" class="prevPage"><上一页</a>');
        }else{
            prevLi.remove('.prevPage');
            prevLi.append('<span class="disabled"><上一页</span>');
        }
        //中间页码
        if(currNum != 1 && number >= 4 && number != 4 && currNum >= 4){
            pageUl2.append('<li class="numb"><a href="javascript:getPage(1)" class="tcdNumber">'+1+'</a></li>');
        }
        if(currNum-2 > 2 && currNum <= number && number > 5){
            pageUl2.append('<li class="li_span"><span>...</span></li>');
        }
        var start = currNum -2,end = currNum+2;
        if((start > 1 && currNum < 4)||currNum == 1){
            end++;
        }
        if(currNum > number-4 && currNum >= number){
            start--;
        }
        for (;start <= end; start++) {
            if(start <= number && start >= 1){
                if(start != currNum){
                    pageUl2.append('<li class="numb"><a href="javascript:getPage('+ start +')" class="tcdNumber">'+ start +'</a></li>');
                }else{
                    pageUl2.append('<li class="numb choose"><span class="current">'+ start +'</span></li>');
                }
            }
        }
        if(currNum + 2 < number - 1 && currNum >= 1 && number > 5){
            pageUl2.append('<li class="li_span"><span>...</span></li>');
        }
        if(currNum != number && currNum < number -2  && number != 4){
            pageUl2.append('<li class="numb"><a href="javascript:getPage('+ number +')" class="tcdNumber">'+number+'</a></li>');
        }
        //下一页
        if(currNum <number){
            nextLi.append('<a href="javascript:getPage(' + parseInt(currNum + 1) + ')" class="nextPage">下一页></a>');
        }else{
            nextLi.remove('.nextPage');
            nextLi.append('<span class="disabled">下一页></span>');
        }
        pageNumber.append('<span class="pagecount">共'+number+'页</span>');
        if(currNum == 1) {
            $('.prev').removeClass('selected_paging').removeClass('hover').css('cursor', 'text').find('a').css('cursor', 'text');
        }
        if(currNum == 1 && number > 1) {
            $('.next').addClass('selected_paging');
        }
        if(currNum == number) {
            $('.next').removeClass('selected_paging').removeClass('hover').css('cursor', 'text').find('a').css('cursor', 'text');
        }
        if(currNum == number && currNum > 1) {
            $('.prev').addClass('selected_paging');
        }
        if(currNum !== number && currNum > 1) {
            $('.prev').addClass('selected_paging');
            $('.next').addClass('selected_paging');
        }
        $('.choose').addClass('selected_paging').siblings().removeClass('selected_paging').addClass('hover');
	}
	//试卷id
	var qid = window.location.search.split("=")[1];
	//获取题型
	$.ajax({
		url: localApi + "/PaperSection/index",
		type: 'GET',
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		async: false,
		data: {
			apikey: '1',
			pid: qid
		},
		success: function(result) {
//			console.log(result.data);
			$.each(result.data, function(n, item) {
				$("select[name='sectionName']").append("<option value='" + item.id + "'>" + item.sectionName + "</option>");
			});
		}
	});
	var id = 0;
	var content = "";
	//点击添加
	$(document).on('click', '.tpl-table-black-operation-del', function() {
		id = $(this).attr("value");
		content = $($(this).parent().siblings()[2]).text();
//		console.log(id);
//		console.log(content);
		/* if($("select[name='sectionName']").val() == null) {
		     alert("请先设置章节");
		 } else {
		 	
		 }*/
	});
	//请求数据
	$.ajax({
		url: localApi + "/PaperDetail/index",
		type: 'GET',
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		data: {
			apikey: '1',
			pid: qid
		},
		success: function(result) {
			if(result.msg == "success") {
				var c = [];
				$.each(result.data, function(n1, item1) {
//					console.log(result.data);
					if(c[item1.sid] != item1.sid) {
						c[item1.sid] = item1.sid;
						var number = 0;
						$.each(result.data, function(n2, item2) {
							if(item1.sid == item2.sid) {
								if(number == 0) {
									var coulmn1 = '<tr class="even gradeX student add_p4" id="' + item2.sid + '"><td style="text-align:center" >' + item2.paperSection.sectionName + '</td><td class="qidold">' + item2.qid + '</td><td><p>' + item2.questionWithBLOBs.content + '</p></td><td><p class="scoreold">' + item2.score;
									coulmn1 += '</p></td><td class="operation"><div class="tpl-table-black-operation"><a href="#myModal20" data-toggle="modal" value=' + item2.qid + ' class="tpl-table-black-operation-del button button--aylen detail"> <i class="QK1 QK-xiangqing"></i> 详情</a>' + '<a href="javascript:;" value=' + item2.qid + "," + item2.sid + '  class="tpl-table-black-operation-dell button button--aylen" ><i class="QK1 QK-shanchu"></i> 删除</a>' + '</div></td></tr>';
									$("#questions").append(coulmn1);
									number = number + 1;
								} else {
									var coulmn2 = '<tr class="even gradeX student add_p4"><td class="qidold">' + item2.qid + '</td><td><p>' + item2.questionWithBLOBs.content + '</p></td><td><p class="scoreold">' + item2.score;
									coulmn2 += '</p></td><td class="operation"><div class="tpl-table-black-operation"><a href="#myModal20" data-toggle="modal" value=' + item2.qid + ' class="tpl-table-black-operation-del button button--aylen detail"> <i class="QK1 QK-xiangqing"></i> 详情</a>' + '<a href="javascript:;" value=' + item2.qid + "," + item2.sid + '  class="tpl-table-black-operation-dell button button--aylen" ><i class="QK1 QK-shanchu"></i> 删除</a>' + '</div></td></tr>';
									$("#questions").append(coulmn2);
									number = number + 1;
								}
							}
							$("#" + item1.sid).children(':first-child').attr("rowspan", number);
						})
					}
				});
				var title_all = $('.gradeX').children('td:nth-child(2)');
				$.each(title_all , function (n , item) {
//				    console.log($(this));
				    $(this).find('div').css('height' , '0');
                });
//                $('.gradeX').children('td:nth-child(2)').children(':first-child').next('div').remove();
                $('.add_p4').children('td:nth-child(2)').children('p:nth-child(2)').siblings().remove();
			} else {
				//                alert("没有数据 请添加")
			}
		},
	});
	var count = 0;
	//提交分数
	$(document).ready(function() {
		$(".submit_mark").click(function() {
			var sectionName = $("select[name='sectionName']").val();
			var score = $("input[name='remark']").val();
			var coulmn = '<tr class="even gradeX student"><td class="qidnew">' + id + '</td><td><p class="scorenew">' + score;
			coulmn += '</p></td><td class="operation"><div class="tpl-table-black-operation"><a href="javascript:;" value=' + count + ' class="sidnew tpl-table-black-operation-del button button--aylen detail"><i class="QK QK-xiangqing"></i>详情</a>' + '<a href="javascript:;" value=' + id + "," + sectionName + ' class="tpl-table-black-operation-del button button--aylen" ><i class="QK QK-shanchu"></i>删除</a></div></td></tr>';
			coulmn += '<tr class="even gradeX student"><td><p>' + content + '</p></td></tr>';
			$("#" + sectionName).append(coulmn);
			$.ajax({
				type: "post",
				url: localApi + "/PaperDetail/add",
				xhrFields: {
					withCredentials: true
				},
				crossDomain: true,
				data: {
					apikey: '1',
					pid: qid,
					qid: id,
					sid: sectionName,
					score: score
				},
				success: function(result) {
					if(result.msg == "success") {
						$("#myModal5").hide();
						console.log("添加成功");
						window.location.href = "setpaper.html" + window.location.search
						//                    var question = '<tr class="even gradeX student add_p2"><td class="qidold">' + result.data.qid + '</td><td><p>' + result.data.questionWithBLOBs.content + '</p></td><td><p class="scoreold">' + result.data.score + '</p></td><td class="operation"><div class="tpl-table-black-operation"><a href="javascript:;" data-toggle="modal" data-target="#myModal" value="123" class="tpl-table-black-operation-del button button--aylen detail"> <i class="QK1 QK-xiangqing"></i> 详情</a><a href="javascript:;" value=' + result.data.qid+","+result.data.sid+ ' class="tpl-table-black-operation-del button button--aylen"><i class="QK1 QK-shanchu"></i> 删除</a></div></td></tr>'
					}
				}
			});
		});
	});

	//问题详情
	$(document).on('click', '.detail', function() {
		var questionid = $(this).attr("value");
		$.ajax({
			type: "get",
			url: localApi + "/QuestionWithBLOBs/get",
			xhrFields: {
				withCredentials: true
			},
			crossDomain: true,
			data: {
				id: questionid,
				apikey: '1'
			},
			success: function(result) {
//			    console.log(result.data);
			    var title = '<h4 class="modal-title">'+ result.data.content +'</h4>';
			    $('.title_header').append(title);
//				var conten = '<li><P>' + result.data.content + '</P></li>';
//				$("#detailcontent").select("ul").append(conten);
				$.each(result.data.questionOptions, function(n, item) {
				    if(item.salisa == 'A') {
                        var coulmn = '<li><strong>' + item.salisa + '.</strong>&nbsp;&nbsp;<P>' + item.soption + '</P></li>'
                        $("#detailcontent").select("ul").append(coulmn)
                    }
				});
                $.each(result.data.questionOptions, function(n, item) {
                    if(item.salisa == 'B') {
                        var coulmn = '<li><strong>' + item.salisa + '.</strong>&nbsp;&nbsp;<P>' + item.soption + '</P></li>'
                        $("#detailcontent").select("ul").append(coulmn)
                    }
                });
                $.each(result.data.questionOptions, function(n, item) {
                    if(item.salisa == 'C') {
                        var coulmn = '<li><strong>' + item.salisa + '.</strong>&nbsp;&nbsp;<P>' + item.soption + '</P></li>'
                        $("#detailcontent").select("ul").append(coulmn)
                    }
                });
                $.each(result.data.questionOptions, function(n, item) {
                    if(item.salisa == 'D') {
                        var coulmn = '<li><strong>' + item.salisa + '.</strong>&nbsp;&nbsp;<P>' + item.soption + '</P></li>'
                        $("#detailcontent").select("ul").append(coulmn)
                    }
                });
                $.each(result.data.questionOptions, function(n, item) {
                    if(item.salisa == 'E') {
                        var coulmn = '<li><strong>' + item.salisa + '.</strong>&nbsp;&nbsp;<P>' + item.soption + '</P></li>'
                        $("#detailcontent").select("ul").append(coulmn)
                    }
                });
                $.each(result.data.questionOptions, function(n, item) {
                    if(item.salisa == 'H') {
                        var coulmn = '<li><strong>' + item.salisa + '.</strong>&nbsp;&nbsp;<P>' + item.soption + '</P></li>'
                        $("#detailcontent").select("ul").append(coulmn)
                    }
                });
                $.each(result.data.questionOptions, function(n, item) {
                    if(item.salisa == 'G') {
                        var coulmn = '<li><strong>' + item.salisa + '.</strong>&nbsp;&nbsp;<P>' + item.soption + '</P></li>'
                        $("#detailcontent").select("ul").append(coulmn)
                    }
                });

			},
			error: function() {
				alert("123")
			}
		});
	});
	//关闭
	$(document).on('click', '.deleteall', function() {
	    $('.modal-title').empty();
		$("#detailcontent").select("ul").empty();
	});

	//删除问题
	$(document).on('click', '.tpl-table-black-operation-dell', function() {
		var paperDetail = $(this).attr("value");
		console.log(paperDetail);
		var id = paperDetail.split(",")[0];
		console.log(id);
		var sectionName = paperDetail.split(",")[1];
		console.log(sectionName);
		$.ajax({
			type: "post",
			url: localApi + "/PaperDetail/delete",
			xhrFields: {
				withCredentials: true
			},
			crossDomain: true,
			data: {
				apikey: '1',
				pid: qid,
				qid: id,
				sid: sectionName,
			},
			success: function(result) {

				alert("删除成功")
				window.location.href = "setpaper.html" + window.location.search

			}
		});
		var a = $(this).parent().parent();
		a.next().remove();
		a.remove();
	});

	//提交
	$(document).on('click', '#btnsubmit', function() {
		window.location.href = "paper.html"
	});
</script>
<script type="text/javascript">
	// add the animation to the popover
	$('a[rel=popover]').popover().click(function(e) {
		e.preventDefault();
		var open = $(this).attr('data-easein');
		if(open == 'shake') {
			$(this).next().velocity('callout.' + open);
		} else if(open == 'pulse') {
			$(this).next().velocity('callout.' + open);
		} else if(open == 'tada') {
			$(this).next().velocity('callout.' + open);
		} else if(open == 'flash') {
			$(this).next().velocity('callout.' + open);
		} else if(open == 'bounce') {
			$(this).next().velocity('callout.' + open);
		} else if(open == 'swing') {
			$(this).next().velocity('callout.' + open);
		} else {
			$(this).next().velocity('transition.' + open);
		}

	});

	// add the animation to the modal
	$(".modal").each(function(index) {
		$(this).on('show.bs.modal', function(e) {
			var open = $(this).attr('data-easein');
			if(open == 'shake') {
				$('.modal-dialog').velocity('callout.' + open);
			} else if(open == 'pulse') {
				$('.modal-dialog').velocity('callout.' + open);
			} else if(open == 'tada') {
				$('.modal-dialog').velocity('callout.' + open);
			} else if(open == 'flash') {
				$('.modal-dialog').velocity('callout.' + open);
			} else if(open == 'bounce') {
				$('.modal-dialog').velocity('callout.' + open);
			} else if(open == 'swing') {
				$('.modal-dialog').velocity('callout.' + open);
			} else {
				$('.modal-dialog').velocity('transition.' + open);
			}

		});
	});
</script>
<script>
	$(document).ready(function() {
		$('select.select').select();
		$(".list_dt").on("click", function() {
			$('.list_dd').stop();
			$(this).siblings("dt").removeAttr("id");
			if($(this).attr("id") == "open") {
				$(this).removeAttr("id").siblings("dd").slideUp();
			} else {
				$(this).attr("id", "open").next().slideDown().siblings("dd").slideUp();
			}
		});
	});
</script>
<script>
	$(document).ready(function() {
		$(".dropdown-button").dropdown();
		$("#sideNav").click(function() {
			if($(this).hasClass('closed')) {
				$('.navbar-side').animate({
					left: '0px'
				});
				$(this).removeClass('closed');
				$('#page-wrapper').animate({
					'margin-left': '260px'
				});
			} else {
				$(this).addClass('closed');
				$('.navbar-side').animate({
					left: '-260px'
				});
				$('#page-wrapper').animate({
					'margin-left': '0px'
				});
			}
		});
	});
	$(".dropdown-button").dropdown();
</script>